package org.xinjiang.tarim.travel.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.xinjiang.tarim.travel.bean.ResourceInterceptor;

//需要将拦截器加载到WebMvcConfigurer
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ResourceInterceptor resourceInterceptor;

    public void addInterceptors(InterceptorRegistry registry) {
        logger.info("执行InterceptorRegistry");
        registry.addInterceptor(resourceInterceptor);
    }

}